﻿@model GPS.ENTITYS.CrudModelQLPT

@{
    ViewBag.Title = "Chi tiết phương tiện";
}

<style type="text/css">
    .btn-file {
        position: relative;
        overflow: hidden;
    }

        .btn-file input[type=file] {
            position: absolute;
            top: 0;
            right: 0;
            min-width: 100%;
            min-height: 100%;
            font-size: 100px;
            text-align: right;
            filter: alpha(opacity=0);
            opacity: 0;
            background: red;
            cursor: inherit;
            display: block;
        }

    input[readonly] {
        background-color: white !important;
        cursor: text !important;
    }
</style>
<div class="modal-header fdb-panel-header-10">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h5 class="modal-title" id="myModalLabel">Thông Tin Phương Tiện</h5>
</div>
@using (Html.BeginForm("Detail", "GPS_PhuongTien", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <div id="tabs">
        <div id="tabs-1">
            @Html.Hidden("IsEdit", 0)
            <div class="row">
                <fieldset class="fs_body">
                    <legend class="head_title">Thông tin phương tiện</legend>
                    <div class="col-lg-10">
                        <div class="col-lg-6">
                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Biển số:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_BIENSO, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label text-left">
                                    Đơn vị đào tạo:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.DVGTVT_TEN, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Màu xe:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_MAUXE, new { @class = "form-control", @id = "PT_MAUXE", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Cơ quan cấp GPLXTL:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_CQCAPGPXTL, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-7 control-label">
                                    Ngày hết hạn ATKT và BVMT:
                                </div>
                                <div class="col-md-4">
                                    @Html.DisplayFor(model => model.PT_NGAYHHGCNKD, "{0:dd/MM/yyyy}", new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Tuyến đường tập lái:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_TUYENDUONG, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Số đăng ký:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_SODK, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Mác xe:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_MACXE, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Số máy:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_SOMAY, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Số khung:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_SOKHUNG, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Ngày cấp GP:
                                </div>
                                <div class="col-md-6">

                                    @Html.DisplayFor(model => model.PT_NGAYGPXTL, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Năm sản xuất:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_NAMSX, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Chất lượng:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_CHATLUONG, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Nhãn hiệu:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_NHANHIEU, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Loại xe:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_LOAIXE, new { @class = "form-control", @readonly = "readonly" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Số giấy phép xe tập lái:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_SOGPXTL, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-7 control-label">
                                    Ngày cấp ATKT và BVMT:
                                </div>
                                <div class="col-md-4">
                                    @Html.DisplayFor(model => model.PT_NGAYGCNKD, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Bảo hiểm TNDS:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_COBAOHIEM, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Trạng thái:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_ACTIVE, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Sở hữu:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_COSOHUU, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Hạng xe:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_HANGXE, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Giấy phép xe tập lái:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_SOGPXTL, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Ngày cấp HH GP:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_NGAYHHGPXTL, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Hệ thống phanh phụ:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_COPHANHPHU, new { @class = "form-control" })
                                </div>
                            </div>

                            <div class="row margin-top-05">
                                <div class="col-md-6 control-label">
                                    Mô tả:
                                </div>
                                <div class="col-md-6">
                                    @Html.DisplayFor(model => model.PT_MOTA, new { @class = "form-control", @rows = 5, @readonly = "readonly" })
                                </div>
                            </div>
                        </div>
                    </div>
                    @*<div class="col-lg-2">
                        <fieldset class="fs_body">
                            <legend class="head_title">Ảnh Đại Diện</legend>
                            <div style="margin: 10px auto; text-align:center;">
                                @{
    String img64Url = string.Empty;
    if (Model.PT_ANHXE != null)
    {
        String img64 = Convert.ToBase64String(Model.PT_ANHXE);
        img64Url = string.Format("data:image/" + Model.PT_ANHXE + ";base64,{0}", img64);
    }

                                }
                                <img id="output_image" src="@img64Url" width="100" height="120" />
                            </div>
                        </fieldset>
                    </div>*@
                </fieldset>
            </div>
            <div class="row margin-top-05 Action_FormDetail">
                <a href="@Url.Action("ExportWord", "GPS_PhuongTien", new { id = Model.PT_ID})" class="btn btn-primary btn-sm">
                    <i class="fa fa-file-excel-o"></i>  Xuất file Word chi tiết phương tiện
                </a>
                &nbsp;&nbsp;
                <button class="btn btn-primary btn-sm" type="button" data-dismiss="modal">Hủy bỏ</button>
            </div>
        </div>
    </div>
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script src="~/Scripts/moment.js"></script>
<script type="text/javascript">

    // Voi jQuery 1.9 > thi chi validate gia tri trong active tab
    // Muon validate nhung gia tri trong cac tab khac nua thi dung jquery.validate 1.8.1 or 1.7
    // mask edit cho truong ngay thang (su dung jquery.maskedinput)
    function ToJavaScriptDate(value) {
        if (value != null) {
            var pattern = /Date\(([^)]+)\)/;
            var results = pattern.exec(value);
            var dt = new Date(parseFloat(results[1]));
            return dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear();
        }
        return null;
    }
</script>

<script type='text/javascript'>
    $(document).on('change', '.btn-file :file', function () {
        var input = $(this),
            numFiles = input.get(0).files ? input.get(0).files.length : 1,
            label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
    });

    function preview_image(event) {
        var reader = new FileReader();
        reader.onload = function () {
            var output = document.getElementById('output_image');
            output.src = reader.result;
        }
        reader.readAsDataURL(event.target.files[0]);
    }
</script>

<script type="text/javascript">
    $("#PT_NGAYGPXTL").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });

    $("#PT_NGAYHHGPXTL").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });

    $("#PT_NGAYGCNKD").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });

    $("#PT_NGAYHHGCNKD").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });

    $("#PT_NGAYGPXTL").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
    $("#PT_NGAYHHGPXTL").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
    $("#PT_NGAYGCNKD").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
    $("#PT_NGAYHHGCNKD").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });

    // cho phep nhap so thap phan (su dung jquery.number)
    //$("#GV_THAMNIENLX").number(true, 2, '.', '');

</script>

@Styles.Render("~/Content/themes/base/css")

<script type="text/javascript">
    $(document).ready(function () {
        $('.btn-file :file').on('fileselect', function (event, numFiles, label) {

            var input = $(this).parents('.input-group').find(':text'),
                log = numFiles > 1 ? numFiles + ' files selected' : label;

            if (input.length) {
                input.val(log);
            } else {
                if (log) alert(log);
            }

        });
    })
</script>
